package com.wwz.controller;

import com.wwz.pojo.User;
import com.wwz.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Slf4j
@RestController
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("list")
    public List queryAllUser(){
        List<User> users = userService.queryAllUser();
        users.forEach(System.out::println);
        return users;
    }

    @GetMapping("{id}")
    public User findById(@PathVariable("id") Long id){
        return userService.findById(id);
    }

}
